<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>JSON字符串转化成js可操作的数据类型</title>
</head>
<body>
    <script>
        let obj = {
            name : "xiaxia",
            sex : "女",
            show : {
                tag : "做自己",
                age : 18
            }
        };

        // 对象转化为json字符串
        let json = JSON.stringify(obj,null,2);

        // 将json字符串转化为对象
        let newObj = JSON.parse(json);
        console.log(newObj);

        let newObj1 = JSON.parse(json,(key,value) => {
            // console.log(key);
            // console.log(value);
            if(key == "name"){
                value = `大美女-${value}`;
            };
            return value;
        });
        console.log(newObj1);
    </script>
</body>
</html>